<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加商品</title>
<link href="${pageContext.request.contextPath}/css/addP.css" rel="stylesheet"></link>
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
	$(function(){ 
		var $proName = $('.proName');
		var $proPrice = $('.proPrice');
		var $proCount = $('.proCount');
		var $proMan = $('.proMan');
		var $proDate = $('.proDate');
		var $proImg = $('.proImg');
		var $proDes = $('.proDes');
		var $proPlace = $('.proPlace');
		var $cId = $('.cId');
		var $proNameVal = $proName.val();
		var $proPriceVal = $proPrice.val();
		var $proCountVal = $proCount.val();
		var $proManVal = $proMan.val();
		var $proDateVal = $proDate.val();
		var $proImgVal= $proImg.val();
		var $proDesVal = $proDes.val();
		var $proPlaceVal = $proPlace.val();
		var $cIdVal = $cId.val();
		
		$("#sub_1").click(function(){
			if($proNameVal==!''&&$proPriceVal==!''&&$proCountVal==!''&&$proManVal==!''&&$proDateVal==!''&&$proImgVal==!''&&$proImgVal.length()!=0&&$proDesVal==!''&&$proPlaceVal==!''&&$cIdVal==!''){
			}
			else{
				alert("添加成功");
			}
		})
	}) 
</script>
</head>
<body>
	<form action="addProServ" method="post" enctype="multipart/form-data">
		<table>
			<tr>
				<td>商品名</td>
				<td><input type="text" name="proName"/></td>
			</tr>
			<tr>
				<td>商品价格</td>
				<td><input type ="text" name="proPrice"/></td>
			</tr>
			<tr>
				<td>商品数量</td>
				<td><input type ="number" name="proCount"/></td>
			</tr>
			<tr>
				<td>生产厂商</td>
				<td><input type ="text" name="proMan"/></td>
			</tr>
			<tr>
				<td>生产日期</td>
				<td><input type ="Date" name="proDate"/></td>
			</tr>
			<tr>
				<td>上传图片</td>
				<td><input type="file" name="proImg"><span>${error}</span></td>
			</tr>
			<tr>
				<td>商品描述</td>
				<td><textarea name="proDes"></textarea></td>
			</tr>
			<tr>
				<td>生产地</td>
				<td><input type ="text" name="proPlace"/></td>
			</tr>
			<tr>
				<td>类别ID</td>
				<td><input type ="text" name="cId"/></td>
			</tr>
			<tr>
				<td colspan="2"><input type="submit" value="添加" id="sub_1"></td>
			</tr>
		</table>
	</form>
</body>
</html>